using System;
using System.Collections.Generic;
using System.Linq;
using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Wordprocessing;

namespace converter.template.item
{
    /// <summary>
    /// A document's paragraph.
    /// </summary>
    internal class Paragraph : TemplateItem
    {
        /// <summary>
        /// Creates a paragraph element.
        /// </summary>
        /// <param name="parent">The paragraph's parent element -- Body.</param>
        public override void Build(OpenXmlCompositeElement parent)
        {
            DocumentFormat.OpenXml.Wordprocessing.Paragraph elem = new DocumentFormat.OpenXml.Wordprocessing.Paragraph();
            parent.AppendChild(elem);
            // Go through the children elements.
            foreach (TemplateItem item in Items)
                item.Build(elem);
        }

        //// Adds an ElementPara to the document.
        //public override void Build(Template template, net.windward.document.Document document)
        //{
        //    ElementPara paragraph = new ElementPara(document);
        //    document.addBody(paragraph);

        //    foreach (TemplateItem item in Items)
        //        item.Build(template, document, paragraph);
        //}

        //// Adds an ElementPara to a cell.
        //public override void Build(Template template, net.windward.document.Document document, ElementCell cell)
        //{
        //    ElementPara paragraph = new ElementPara(document);
        //    cell.addBody(paragraph);

        //    foreach (TemplateItem item in Items)
        //        item.Build(template, document, cell, paragraph);
        //}
    }
}
